#pragma once
#include "resource.h"
#include "MxPluginManager\MxPluginLib1.h"

#include "PublicInterfaces\{FAFD3CB8-FCF3-46EE-B32E-45A4FF68073E}\IImageComputePluginLib.h"
#include "PublicInterfaces\{FAFD3CB8-FCF3-46EE-B32E-45A4FF68073E}\IImageComputeFnDef.h"
#include "PublicInterfaces\{FAFD3CB8-FCF3-46EE-B32E-45A4FF68073E}\IImageComputeFn.h"
#include "PublicInterfaces\{FAFD3CB8-FCF3-46EE-B32E-45A4FF68073E}\IImageCompute.h"

#include  "..\..\PublicInterfaces\PluginICPopenCV\PluginICPopenCVErrorCodes.h"

#ifdef PluginICPopenCV_EXPORTS
#define PluginICPopenCV_API __declspec(dllexport)
#else
#define PluginICPopenCV_API __declspec(dllimport)
#endif

class PluginICPopenCV_API ImageComputePluginLib :	public IImageComputePluginLib
{
public:
	ImageComputePluginLib(void);
	~ImageComputePluginLib(void);

	virtual const char *MXSTDMETHOD GetProductID() { return PluginICPopenCVLib::VerInfo::Inst().GetProductID(); }
	virtual const char *MXSTDMETHOD GetProductName() { return PluginICPopenCVLib::VerInfo::Inst().GetProductName(); }
	virtual const char *MXSTDMETHOD GetVersion() { return PluginICPopenCVLib::VerInfo::Inst().GetVersion(); }
	virtual const char *MXSTDMETHOD GetDescription() { return PluginICPopenCVLib::VerInfo::Inst().GetDescription(); }
	virtual int			MXSTDMETHOD GetToolboxIconID() { return IDI_TOOLBOX_ICON; } 
	virtual const char *MXSTDMETHOD GetToolboxLabel() { return "OpenCV"; }

	virtual IImageCompute*	MXSTDMETHOD GetIImageCompute();

	virtual bool		MXSTDMETHOD IsValid() { return _valid; }

	virtual long		MXSTDMETHOD DestroyPtr(void);
	virtual long		MXSTDMETHOD DuplicatePtr(void);
	virtual void *		MXSTDMETHOD Dynamic_cast(const GUID IId);
	virtual const GUID  MXSTDMETHOD GetInterfaceGUID(void)  { return IImageComputePluginLibIID::Guid(); }				
	virtual const char *MXSTDMETHOD GetInterfaceName(void) { return IImageComputePluginLibIID::Name(); }				


private:
	bool	MXSTDMETHOD Validate();
	bool	MXSTDMETHOD SetFunctionDefs(IImageCompute *iImageCompute); 

private:

	bool	_valid;
	long    _refCnt;
	MxPluginManager *	  _pluginMngr;
	IImageCompute *		  _iImageCompute;

};

